package org.now.ypos.user.entity;


import org.now.ypos.core.BaseEntity;

import java.util.Objects;
import java.util.StringJoiner;

/**
 * User entity
 *
 * @author wl
 * @since 2020.11.10
 */

public class User extends BaseEntity {
    /**
     * name.
     */
    private String name;
    /**
     * age.
     */
    private Integer age;
    /**
     * email.
     */
    private String email;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        User user = (User) o;
        return Objects.equals(name, user.name) &&
                Objects.equals(age, user.age) &&
                Objects.equals(email, user.email);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), name, age, email);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", User.class.getSimpleName() + "[", "]")
                .add("super='" + super.toString() + "'")
                .add("name='" + name + "'")
                .add("age=" + age)
                .add("email='" + email + "'")
                .toString();
    }
}
